package com.iversonx.adapter.example_1.remote.file;

import com.iversonx.adapter.example_1.service.v0.LogServiceV0;
import com.iversonx.adapter.model.LogData;
import com.iversonx.adapter.example_1.domain.LogModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 *
 */
@Service
public class LogFileOperate implements LogFileOperateApi {
    private final static Logger LOGGER = LoggerFactory.getLogger(LogFileOperate.class);
    
    @Override
    public Map<String, LogModel> readLog() {
        // 模拟从文件中读取日志
        LOGGER.info("从文件中读取日志");
        return LogData.DATA;
    }
    
    @Override
    public void writeLog(Map<String, LogModel> data) {
        LOGGER.info("写入日志到文件");
        LogData.DATA = data;
    }
}
